# -*- coding: utf-8 -*-
from PhysicObject import *
#from spikes import *
#from enemyball import *
#from changeblock import *
#from speedblock import *
#from goal import *
TILE_SIZE = 10
DISPLAY_SIZE = (800, 600)

class Reboot(PhysicObject):
    images = load_image(['images/ball violeta.png',
         'images/ball roja.png','images/ball verde.png'])
   
   
    def __init__(self, world, x, y, i_type):
        self.world = world
        self.b_type = i_type
        bodyDef = box2d.b2BodyDef()
        bodyDef.position = (x, y)
        bodyDef.userData = self
        self.body = self.world.world.CreateBody(bodyDef)
        shapeDef = box2d.b2CircleDef()
        shapeDef.radius = 4.6

        shapeDef.friction = 0.95
        shapeDef.restitution = 1.5
##        self.body.AllowSleeping(True)
        self.shape=self.body.CreateShape(shapeDef)

       

       
                
    def draw( self, surface, offset_x=0, offset_y=0 ):

        offset_x = 45 
        offset_y = 50

        self.image = self.images[self.b_type]
        
        pos = self.body.GetPosition()
        
        
        surface.blit(self.image, (int(pos.x*TILE_SIZE)-offset_x,
                     int(pos.y*TILE_SIZE)-offset_y))
        #surface.blit(self.image, (0,
         #            0))

    def sleeping( self):
        return self.body.IsSleeping()

    def destroy( self):
        """Destruye el objeto """
        self.body.DestroyShape (self.shape)    
